home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / demos / demobook / bookgfx.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  6.5 KB  |  149 lines

  1. /*
  2.  * Copyright 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. #define OPENFRAMES  14    /* number of keyframes to open the book */
  18. #define COVERSEGS   2    /* number of horizontal segments for cover */
  19. #define BINDINGSEGS 4    /* number of horizontal segments for binding */
  20. #define TWOD        2    /* these are 2D arrays */
  21. #define SCALE (1.0/96000.0)    /* 2D data is 96000 units/inch */
  22. #define COVEROVERHANG 0.25    /* Cover overhang beyond pages (1/4") */
  23. #define PGHT 10.0        /* Page height is 10" */
  24. #define ROTINC 10
  25. #define CLOCKWISE 1
  26. #define COUNTER_CLOCKWISE -1
  27.  
  28. /* This is the 2d array of keyframes for right side pages of the opening book.
  29.    The opening book is symmetrical around the binding, so we just mirror them
  30.    for the left side.  NOTE:openpg[0] is the open book and openpg[13] is the
  31.    closed book */
  32.  
  33. float openpg[OPENFRAMES][PGSEGS][TWOD] = {
  34.     {{0,0},{173426,82387},{364780,98117},{554375,67827},{744279,39553},
  35.     {935809,26124}},
  36.     {{0,0},{168819,91456},{359800,111206},{549852,83925},{740180,58665},
  37.     {932039,51347}},
  38.     {{0,0},{162728,101900},{353385,124581},{544101,102442},{735043,82328},
  39.     {926981,77478}},
  40.     {{0,0},{155124,113139},{343982,147742},{534895,127377},{726016,109038},
  41.     {917991,105973}},
  42.     {{0,0},{146425,124193},{332000,173444},{523178,155700},{714314,137537},
  43.     {906303,139736}},
  44.     {{0,0},{136069,135461},{317130,199336},{509115,196876},{701090,193993},
  45.     {892294,211477}},
  46.     {{0,0},{125072,145678},{297500,230124},{488241,252076},{680105,259223},
  47.     {870362,285071}},
  48.     {{0,0},{111858,156054},{271824,262231},{458304,307942},{646857,344144},
  49.     {830221,401093}},
  50.     {{0,0},{96285,166114},{244582,288062},{423182,358531},{602074,428254},
  51.     {771173,519191}},
  52.     {{0,0},{77075,175852},{207969,315963},{365236,426105},{521439,537749},
  53.     {666004,664103}},
  54.     {{0,0},{56103,183622},{160176,344967},{280074,494929},{391933,650978},
  55.     {494182,813485}},
  56.     {{0,0},{30763,189521},{95152,370402},{178804,543220},{253268,720191},
  57.     {316929,901329}},
  58.     {{0,0},{10423,191718},{123862,756196},{156985,945315},{83805,568421},
  59.     {123862,756196}},
  60.     {{0,0},{0,192000},{0,384000},{0,576000},{0,768000},{0,960000}}
  61. };
  62.  
  63. /* This is the 2d array of keyframes for right side cover of the  opening book.
  64.    The opening book is symmetrical around the binding, so we just mirror them
  65.    for the left side */
  66. static float opencover[OPENFRAMES][COVERSEGS][TWOD] = {
  67.     {{96000,-48000},{1128000,-48000}},
  68.     {{96000,-48000},{1127681,-22376}},  
  69.     {{96000,-48000},{1126370,9993}},  
  70.     {{96000,-48000},{1123459,48706}},  
  71.     {{96000,-48000},{1117578,98297}},  
  72.     {{96000,-48000},{1103087,177387}},  
  73.     {{96000,-48000},{1080481,261551}},  
  74.     {{96000,-48000},{1026808,397669}},  
  75.     {{96000,-48000},{951516,529162}},  
  76.     {{96000,-48000},{825999,681469}},  
  77.     {{96000,-48000},{635555,831718}},  
  78.     {{96000,-48000},{443958,923570}},  
  79.     {{96000,-48000},{267760,969606}},  
  80.     {{96000,-48000},{96000,984000}},  
  81. };
  82.  
  83. /* These are the coordinates for the binding.  This is the weakes part of the
  84.    book right now.  It needs to be animated more (maybe a bevel or curve) */
  85. static float binding[BINDINGSEGS][TWOD] =
  86.     {{-96000,-48000},{-76000,-64000},{76000,-64000},{96000,-48000}};
  87.  
  88. /* This is the 2d array of keyframes for the turning a page from right to left.
  89.    Just mirror this around the binding (y=0) to turn pages from left to right.
  90.    NOTE:openpg[0] is the right open book page and openpg[13] is the left open
  91.    book page */
  92. static float turnpg[TURNFRAMES][PGSEGS][TWOD] = {
  93.     {{0,0},{173426,82387},{364780,98117},{554375,67827},
  94.     {744279,39553},{935809,26124}},  
  95.     {{0,0},{158666,108118},{349528,128984},{537420,89485},
  96.     {725720,51984},{916739,32596}},  
  97.     {{0,0},{129655,141612},{319613,169529},{505392,121051},
  98.     {691062,72165},{880870,43234}},  
  99.     {{0,0},{85155,172086},{267046,233552},{450736,177671},
  100.     {629554,107766},{815870,61383}},  
  101.     {{0,0},{29916,189657},{173227,317427},{363453,291389},
  102.     {534070,203333},{709434,125160}},  
  103.     {{0,0},{-27423,190033},{77439,350866},{260511,408735},
  104.     {445618,357754},{610599,259544}},  
  105.     {{0,0},{-77784,175539},{-38022,363375},{103241,493409},
  106.     {290813,534407},{481520,512174}},  
  107.     {{0,0},{-112510,155582},{-145034,344806},{-87895,528107},
  108.     {52574,658995},{235849,716215}},  
  109.     {{0,0},{-136781,134740},{-244756,293501},{-276208,482908},
  110.     {-237636,670991},{-161282,847155}},  
  111.     {{0,0},{-149782,120123},{-297873,242321},{-424883,386308},
  112.     {-545678,535546},{-664298,686520}},  
  113.     {{0,0},{-160934,104710},{-333717,188437},{-517937,242538},
  114.     {-708455,265073},{-900316,272322}},  
  115.     {{0,0},{-167446,93947},{-351424,148871},{-543117,138061},
  116.     {-733853,116088},{-925009,98113}},  
  117.     {{0,0},{-171372,86580},{-360364,120437},{-550633,94730},
  118.     {-740244,64551},{-931488,47528}},  
  119.     {{0,0},{-173426,82387},{-364780,98117},{-554375,67827},
  120.     {-744279,39553},{-935809,26124}},  
  121. };
  122.  
  123.  
  124. static float ropenpg[OPENFRAMES][PGSEGS][VPGSEGS][THREED];  /* left and right array of */
  125. float lopenpg[OPENFRAMES][PGSEGS][VPGSEGS][THREED];  /* pages to open book */
  126.  
  127. static float ropenbasepg[OPENFRAMES][3][2][THREED]; /* pages next to cover for filling */ 
  128. float lopenbasepg[OPENFRAMES][3][2][THREED]; /* in side pages */
  129.  
  130. static float sbinding[BINDINGSEGS][2][3];  /* back side of book */
  131.  
  132. static float ropencover[OPENFRAMES][COVERSEGS][2][THREED];    /* cover for book */
  133. static float lopencover[OPENFRAMES][COVERSEGS][2][THREED];
  134.  
  135. static float rtolpglst[TURNFRAMES][PGSEGS][VPGSEGS][THREED];
  136. static float ltorpglst[TURNFRAMES][PGSEGS][VPGSEGS][THREED];
  137.  
  138. static float crackvtx[2][THREED];    /* crack between left and right pages */
  139.  
  140. static float sqrttable[4000];
  141.  
  142. static float rtolnorm[TURNFRAMES][PGSEGS][VPGSEGS][3];
  143. static float ltornorm[TURNFRAMES][PGSEGS][VPGSEGS][3];
  144.  
  145. static float pgcolor[3] = {1.0,1.0,1.0};    /* white */
  146. static float crackcolor[3] = {0.45,0.45,0.45};    /* gray */
  147. static float pgedgecolor[3] = {1.0,1.0,0.0};    /* yellow */
  148. static float covercolor[3] = {1.0,0.0,0.0};    /* red */
  149.